package com.qys.livesMall.shortVideo.model.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * Created by IntelliJ IDEA.
 * User: dp
 * Date: 2023/04/20
 * Time: 17:53
 * DESCRIPTION: 短视频操作类型
 */
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ShortVideoEventTypeEnum {

    LIKE("点赞", 0),
    COLLECTION("收藏", 1),
    FORWARD("转发", 2),
    WATCH("查看", 3),
    ;

    private final String name;
    private final Integer code;

    public static ShortVideoEventTypeEnum getEnum(Integer code) {
        for (ShortVideoEventTypeEnum typeEnum : ShortVideoEventTypeEnum.values()) {
            if (Objects.equals(typeEnum.getCode(), code)) {
                return typeEnum;
            }
        }
        return null;
    }
}
